<template>
  <div class="structure-attr">
    <BaseInfo :="$attrs" :formList="formList"></BaseInfo>
  </div>
</template>

<script setup name="structureAttr">
import { useConvertForm } from '@/hooks';
import BaseInfo from '@/views/components/baseInfo.vue';
import { usePartStructureStore } from '@/store';

const store = usePartStructureStore();
const { partApi } = window.$api;
const formList = ref([]);

const oid = computed(() => store.oid);
watch(
  () => oid.value,
  () => {
    oid.value && getWTPartStructureLayout();
  },
);
onMounted(() => {
  getWTPartStructureLayout();
});
const getWTPartStructureLayout = () => {
  partApi.getWTPartStructureLayout({ oid: oid.value }).then((res) => {
    if (res.data) {
      formList.value = useConvertForm(res.data);
    }
  });
};
</script>

<style scoped lang="less">
.structure-attr {
  padding-top: 10px;
  height: 100%;
  overflow-y: auto;
}
</style>
